import { Controller, Get, Post, Body, Query } from '@nestjs/common';
import { ApiTags } from '@nestjs/swagger';
import { DistributionRate_Service } from './distributionRate.service';
import { DistributionRate_Create_Dto } from './assets/distributionRate.dto';
import { DistributionRate_FindByUserClientId_Dto } from './assets/distributionRate.dto';
import { util_ApiResponse_Base } from '@/common/util/apiResponse';
import { util_Index_ReturnContent } from '@/common/util/index';

@Controller('/adm/distributionRate')
@ApiTags('distributionRate 分销比例配置')
export class DistributionRate_Controller {
  constructor(private readonly distributionRate_Service: DistributionRate_Service) {}

  @Post('/add')
  @util_ApiResponse_Base({
    dataType: 'dataType_add',
  })
  async distributionRate_Create(@Body() body: DistributionRate_Create_Dto) {
    return util_Index_ReturnContent(await this.distributionRate_Service.distributionRate_Create(body));
  }

  @Get('/distributeAll')
  @util_ApiResponse_Base({
    dataType: 'dataType_ell',
    summary: '推广者推广比例详情',
  })
  async distributionRate_FindByUserClientId(@Query() query: DistributionRate_FindByUserClientId_Dto) {
    return util_Index_ReturnContent(
      await this.distributionRate_Service.distributionRate_FindByUserClientId(query),
    );
  }
}
